package operation;

import book.Book;
import book.BookList;

import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: XMQ
 * Date: 2022-05-26
 * Time: 9:11
 */
public class AddOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("新增图书");
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入书名:");
        String name = scanner.nextLine();
        System.out.println("请输入作者名:");
        String author = scanner.nextLine();
        System.out.println("请输入作者国籍:");
        String nation = scanner.nextLine();
        System.out.println("请输入书的类型:");
        String type = scanner.nextLine();
        Book book = new Book(name,author,nation,type);
        bookList.setBook(bookList.getUsedSize(),book);
        bookList.setUsedSize(1);
        System.out.println("新增成功！");
    }
}
